package com.xc.service.baseService.impl;

import org.springframework.stereotype.Component;

@Component
public class ThreadLocalService {
    private ThreadLocal<String> threadLocal = new ThreadLocal<>();

    public String getThreadLocal() {
        return threadLocal.get();
    }

    /**
     * 字符串类型的账号，不是用户id
     * @param id
     */
    public void setThreadLocal(String id) {
        threadLocal.set(id);
    }

    public void removeThreadLocal() {
        threadLocal.remove();
    }
}
